package com.yygo.service;

import com.yygo.model.Dealer;
import com.yygo.model.Feedback;
import com.yygo.model.LoanRequest;
import com.yygo.model.User;
import com.yygo.webapp.helper.ExtendedPaginatedList;
import org.displaytag.properties.SortOrderEnum;

import java.util.Date;
import java.util.List;
import java.util.Set;

/**
 * Created by tiansha on 2015/6/13.
 */
public interface LoanRequestManager extends GenericManager<LoanRequest, Long> {

    LoanRequest saveLoanRequest(LoanRequest loanRequest);

    LoanRequest loadWholeLoanRequest(Long id);

    LoanRequest getLoanRequest(Long id);

    List<Feedback> getFeedbacks(Long reqId);

    List<LoanRequest> getPolicyRequests(User user, Date date, String name, String salesman, ExtendedPaginatedList paginatedList) throws IllegalAccessException;

    List<LoanRequest> getMyLoanRequests(String phase, User user, ExtendedPaginatedList paginatedList);

    List<LoanRequest> searchLoanRequests(User user, String status, Date date, String number, String name, ExtendedPaginatedList paginatedList);

    List<LoanRequest> getLoanedToTransferRequests(User user, Date date, String number, String name, ExtendedPaginatedList paginatedList);


    List<LoanRequest> getFeedbackRequests(User user);

    LoanRequest getNextForRuleProcessing();

    Set<LoanRequest> getRequestsForSlave();

    LoanRequest getLoanRequestByNumber(String number);

    int getRecentRequestCountByDealer(Dealer dealer, int days);
    int getRecentDeniedRequestCountByDealer(Dealer dealer, int days);

    void clearCache();
}
